⚡ Bolt: Skip expensive SVG path generation when aggregating total distance#132
⚡ Bolt: Skip expensive SVG path generation when aggregating total distance#132OsakaLOOP wants to merge 1 commit intobefore-refractorfrom
Conversation
…tance When calculating total distance stats across all trips, we previously executed costly mathematical operations (PCA, BBox) and built huge SVG `visualPaths` arrays just to throw them away. This adds an optional `skipVisuals` flag to `getRouteVisualData` to skip pushing and formatting unused arrays entirely. Co-authored-by: OsakaLOOP <68284076+OsakaLOOP@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
⚡ Bolt: Skip expensive SVG path generation when aggregating total distance
What:
Added an optional
skipVisualsparameter togetRouteVisualDatawhich bypasses the expensive PCA, Bounding Box, and SVG string generation logic. UpdatedcalculateLatestStatsto utilize this flag when aggregating thegrandTotalDistacross all segments.Why:
When aggregating stats across all user trips (e.g.
calculateLatestStatsintripCalculator.js), the application was generating full SVG projection paths for every single coordinate just to throw it away, since only thetotalDistinteger was used. This causes a linear slowdown and immense garbage collection pressure on large datasets or during folder updates.Impact:
Massively reduces memory allocation and CPU overhead during synchronous data loading and aggregation, particularly noticeable for users with many trips, eliminating O(N) path generation latency.
Measurement:
Verify that the overall total distance in the Stats page continues to display accurately, while evaluating lower CPU profiling times during
calculateLatestStatsinitialization or when switching between multiple folders.PR created automatically by Jules for task 14776907172939540652 started by @OsakaLOOP